<script>
//图表标题配置
import BaseConfig from '../BaseConfig';
import * as ConfigEnum from '../config/config-enum';

export default {
  name: 'LabelConfig',
  mixins: [BaseConfig],
  data() {
    return {
      stackLabelPos: ConfigEnum.STACK_LABEL_POSITION, //标签位置枚举
    };
  },
};
</script>

<template>
  <div>
    <Row>
      <Col span="8">
      <span>显示标签：</span>
      </Col>
      <Col span="16">
      <Switch
        v-model="chartOptions.settings.label.normal.show"
        @on-change="updateOptions">
        <span slot="open">是</span>
        <span slot="close">否</span>
      </Switch>
      </Col>
    </Row>
    <div
      v-if="chartOptions.settings.label.normal.show"
      class="switch-box">
      <Row>
        <Col span="8">
        <span>显示位置：</span>
        </Col>
        <Col span="16">
        <Select
          v-model="chartOptions.settings.label.normal.position"
          @on-change="updateOptions">
          <Option
            v-for="item in stackLabelPos"
            :value="item.value"
            :key="item.value">{{ item.key }}</Option>
        </Select>
        </Col>
      </Row>
      <Row>
        <Col span="8">
        <span>偏移距离：</span>
        </Col>
        <Col span="16">
        <InputNumber
          v-model="chartOptions.settings.label.normal.distance"
          :min="1"
          @on-change="updateOptions"></InputNumber>
        </Col>
      </Row>
      <Row>
        <Col span="8">
        <span>标签颜色：</span>
        </Col>
        <Col span="16">
        <ColorPicker
          v-model="chartOptions.settings.label.normal.color"
          @on-change="updateOptions"></ColorPicker>
        </Col>
      </Row>
      <Row>
        <Col span="8">
        <span>字体大小：</span>
        </Col>
        <Col span="16">
        <InputNumber
          v-model="chartOptions.settings.label.normal.fontSize"
          :min="8"
          @on-change="updateOptions"></InputNumber>
        </Col>
      </Row>
    </div>
  </div>
</template>

<style>
</style>
